package com.sinoatma.physignsmonitor.http

import com.common.frame.net.RetrofitHelper
import com.sinoatma.physignsmonitor.constant.baseIp
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.Body
import java.io.File


object NetManager {

    val apiService by lazy {
        Retrofit.Builder()
            .client(RetrofitHelper.okHttpClient(HeaderInterceptor()))
            .addConverterFactory(GsonConverterFactory.create())
            .baseUrl(baseIp)
            .build().create(HttpApi::class.java)
    }


    /**
     * 在线设备接口
     */
    suspend fun online(@Body body: RequestBody)= apiService.online(body)



    /**
     * 上传采血异常信息接口
     */
    suspend fun exception(@Body body: RequestBody)= apiService.exception(body)


    /**
     * 文件上传接口
     */
    suspend fun  uploadFile(id: RequestBody, file : MultipartBody.Part )= apiService.uploadFile(id,file)


    /***
     * 记录接口
     */
    suspend fun bloodCollectList(@Body body: RequestBody)= apiService.bloodCollectList(body)


    /**
     *个人信息上传接口
     */
     suspend fun personalInfo(@Body body: RequestBody)= apiService.personalInfo(body)


}
